Excel 2021: The Complete User Guide from Beginner to Expert with Useful Tips & Tricks to Master the Excel 2021 New Features for Easy Navigation by Albert Chipman

Excel 2021: The Complete User Guide from Beginner to Expert with Useful Tips & Tricks to Master the Excel 2021 New Features for Easy Navigation by Albert Chipman

Author:Albert Chipman [Chipman, Albert]
Language: eng
Format: mobi, epub
Published: 2021-07-18T16:00:00+00:00


Data Table

If it’s a single row of data you can do something like this:

 Option Explicit

Dim strRow As String

strRow = “E2:F2”

Do Until Sheets(1).Range(strRow).Value = ”

Sheets(1).Range(strRow).EntireRow.ClearContents

Loop

If it’s multiple rows you’ll need to do some more work:

Dim strSheet As String

strSheet = “Sheet1”

With Sheets(1)

For i = 1 To .Cells(.Rows.Count, “A”).End(xlUp).Row

If .Cells(i, “A”) = “E2” Then

.Rows(i).ClearContents

End If

Next i

End With

Or, a simpler way if your data is always going to be in row 2:

Dim strSheet As String

strSheet = “Sheet1”

Sheets(1).Rows(2).Resize(1).Delete

Note: The last two pieces of code rely on the sheet being in the active workbook, so make sure that’s the case first.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.